/*
 *  FIR filter prototype
 *
 *  splib.lib
 */

#ifndef __FIR_H__
#define __FIR_H__

void firInit(float* buff, int* idx, const int NPOW2);
float firRun(const float input, float* buff, const float* coeff, int* idx, const int NPOW2);
float firRun_DP(const float input, float* buff, const double* coeff, int* idx, const int NPOW2);
float firDelay(float input, float* buff, int* idx, const int NPOW2);

void firLMS(float* coeff, const float* buff, int idx, const float e, const float mu, const int NPOW2);
void firLMS_DP(double* coeff, const float* buff, int idx, const float e, const float mu, const int NPOW2);

void firInit2(float* buff2n, int* idx, const int n);
float firRun2(const float input, float* buff2n, const float* coeff, int* idx, const int n);

static __inline float denorm_SP(float x)
{
    x += 1.0e-18f;
    x -= 1.0e-18f;
    return x;
}

static __inline double denorm_DP(double x)
{
    x += 1.0e-150;
    x -= 1.0e-150;
    return x;
}

#endif // __FIR_H__
